#pragma once
#include <stdio.h>
#include <vector>
#include "Property.h"
using namespace std;

#define FINISHED_TURN 0
#define STANDING 1
#define MOVING 2 
#define MOVING_TO_SPACE 3
#define PAY_MONEY 4
#define GET_MONEY 5
#define ANSWERING 6
#define LANDED 7
#define TRADING	8
#define TRADED 9

#define MOVE_CAM_LEFT -1
#define MOVE_CAM_RIGHT -2
#define MOVE_CAM_UP -3
#define MOVE_CAM_DOWN -4

class Game;
class Property;
class Card;

class Player
{
private:
	vector<Property*> m_inventory;
	Game* m_game;
	int m_lastSpace;
	int m_space;
	int m_playerNum;
	int m_state;
	int m_doubles;
	int m_targetSpace;
	char m_avatar;
	int m_inJail;
	int m_money;
	int m_moving;
	int m_curInventory;
	int m_tradeInventory;
	int m_roll;
	int m_colorsOwned[NUM_COLORS];
	bool m_bankrupt;
public:
	Player();

	void Init(Game* a_game, char a_avatar, int a_playerNum);

	void Update();

	int getDoubles();

	void resetDoubles();

	void incrementDoubles();

	void MoveNumSpaces(int a_spaces);

	bool isMoving();

	void MoveForward();

	int CheckInBoundaries(int a_boardX, int a_boardY, int a_offsX, int a_offsY, bool draw);

	int getSpace();

	void GoToSpace(int a_space);

	void releaseFromJail();

	int isInJail();

	void incrementInJail();

	void RollLogic(int a_roll1, int a_roll2);

	int getMoney() { return m_money; }

	void GiveMoney(int a_money) { m_money += a_money; }

	int PayPlayer(Player* a_payee, int a_money);

	void GetMoneyFromPlayer(Player* a_payer, int a_money);

	void PayBank(int a_money);
	
	void doLandingLogic();

	void handleInput(int a_input);

	void DrawInventory();

	void buyAHouse();

	void sellAHouse();

	void mortgageAProperty();

	void doCardLogic(Card* c);

	void GoToJail();

	void StupidHack();

	int getPlayerNum() { return m_playerNum; }

	int getColorsOwned(int a_color) { return m_colorsOwned[a_color]; }

	bool isBankrupt() { return m_bankrupt; }

	void trade(Player* a_trader);

	void tradeProperty(Player* a_trader);
};